package fr.teuteuf.runstickmanrun.map.block;

import com.badlogic.gdx.physics.box2d.World;

import fr.teuteuf.runstickmanrun.map.MapGenerator;
import fr.teuteuf.runstickmanrun.map.tile.MovingSolidBoxTile;
import fr.teuteuf.runstickmanrun.map.tile.SolidBoxTile;
import fr.teuteuf.runstickmanrun.map.tile.Tile;

public class TestBlock extends AbstractMapBlock {

	public TestBlock() {
		setDifficulties(0, 0, 0);
		setCurrentLevel(0);
	}
	
	@Override
	public int generateBlock(World world, MapGenerator mg, int nbHorizontalTiles) {
		int blockLength = 10;
		
		for(int i = 0; i < blockLength; i++) {
			mg.addTile(new SolidBoxTile((byte) 1, 1, 1, (nbHorizontalTiles + i) * Tile.TILE_SIZE, 0 * Tile.TILE_SIZE, world));
		}
		
		mg.addTile(new MovingSolidBoxTile((byte) 15, 1, 1, nbHorizontalTiles * Tile.TILE_SIZE, 3 * Tile.TILE_SIZE, 1, 0, 2 * Tile.TILE_SIZE, 0, world));
		mg.addTile(new MovingSolidBoxTile((byte) 15, 1, 1, (nbHorizontalTiles + 1) * Tile.TILE_SIZE, 3 * Tile.TILE_SIZE, 1, 0, 2 * Tile.TILE_SIZE, 0, world));
		mg.addTile(new MovingSolidBoxTile((byte) 15, 1, 1, (nbHorizontalTiles + 2) * Tile.TILE_SIZE, 3 * Tile.TILE_SIZE, 1, 0, 2 * Tile.TILE_SIZE, 0, world));
		
		for(int i = 0; i < blockLength; i++) {
			mg.addTile(new SolidBoxTile((byte) 1, 1, 1, (nbHorizontalTiles + i) * Tile.TILE_SIZE, 0 * Tile.TILE_SIZE, world));
		}
		
		return nbHorizontalTiles + blockLength;
	}

}
